<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>${_title}</title>
    <!-- Bootstrap core CSS -->
    <link href="${_css}/bootstrap.min.css" rel="stylesheet">
    <link href="${_font}/css/font-awesome.min.css" rel="stylesheet">
    <link href="${_css}/animate.min.css" rel="stylesheet">
    <!-- Custom styling plus plugins -->
    <link href="${_css}/custom.css" rel="stylesheet">
    <link href="${_css}/icheck/flat/green.css" rel="stylesheet">
    <link href="${_css}/datatables/tools/css/dataTables.tableTools.css" rel="stylesheet">
    <script src="${_js}/jquery.min.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
	<style>
		td a{
			cursor:pointer
		}
		
		.about-bank{
			width:450px;
		}
	</style>
</head>
<body style="background: #F7F7F7;">
<div class="">
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
	            <div class="x_title">
					<h2>线下充值列表</h2>
					<div class="clearfix"></div>
				</div>
                <div class="pull-right">
                	<button id="query" type="button" class="btn btn-info">查询</button>
                </div> 
                <form class="form-horizontal form-label-left input_mask">
                	<div class="col-md-2 col-sm-2 col-xs-6 form-group has-feedback">
                        <input type="text" class="form-control has-feedback-left" id="username" value="<#if username?exists>${username}</#if>"
                        placeholder="输入用户名">
                        <span class="fa fa-user form-control-feedback left" aria-hidden="true"></span>
                    </div>
                    <div class="col-md-2 col-sm-2 col-xs-5 form-group has-feedback">
                        <select class="form-control" id="match" >
                        	<option value="-1">--请选择匹配符--</option>
							<option value="GT" <#if match?exists & match=='GT'>selected="selected"</#if>>大于</option>
							<option value="LT" <#if match?exists & match=='LT'>selected="selected"</#if>>小于</option>
							<option value="GE" <#if match?exists & match=='GE'>selected="selected"</#if>>大于等于</option>
							<option value="LE" <#if match?exists & match=='LE'>selected="selected"</#if>>小于等于</option>
							<option value="NE" <#if match?exists & match=='NE'>selected="selected"</#if>>不等于</option>
							<option value="EQ" <#if match?exists & match=='EQ'>selected="selected"</#if>>等于</option>
						</select>
                    </div>
                    <div class="col-md-2 col-sm-2 col-xs-6 form-group has-feedback">
                        <input type="text" class="form-control has-feedback-left" id="money" 
                        onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
                        value="<#if money?exists>${money}</#if>"
                        placeholder="输入充值金额">
                        <span class="fa fa-user form-control-feedback left" aria-hidden="true"></span>
                    </div>
                 </form>    
                <div class="clearfix"></div>
            </div>
            <div class="scroll">    
                <div class="x_content">
                    <div class="" role="tabpanel" data-example-id="togglable-tabs">
                        <div id="myTabContent" class="tab-content">
                            <div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">
				                <div class="x_content">
				                    <table id="example" data-action="/admin/recharge/offline/list?1=1" data-hash="apply" class="table table-striped responsive-utilities jambo_table">
				                        <thead>
				                            <tr class="headings">
				                                <th>
				                                    <input type="checkbox" class="tableflat">
				                                </th>
				                                <th>序号 </th>
				                                <th>流水单号</th>
				                                <th>充值用户 </th>
				                                <th>充值金额 (￥)</th>
				                                <th>充值手续费(￥)</th>
				                                <th>到账金额(￥)</th>
				                                <th>申请时间 </th>
				                                <th class="no-link last"><span class="nobr">操作</span>
				                                </th>
				                            </tr>
				                        </thead>
				
				                        <tbody>
							                <#if (pageInfo.pageList?size > 0)>
												<#list pageInfo.pageList as item>
													<tr class="even pointer">
						                                <td class="a-center ">
						                                    <input type="checkbox" class="tableflat">
						                                </td>
						                                <td>
						                                	${item_index+1}
						                                </td>
						                                <td>
						                                	${item.orderCode}
						                                </td>
						                                <td>
						                                	<a data-toggle="modal" data-id="${item.userId}" data-target=".user-info" class="btn-user">点击查看</a>
						                                </td>		                                
						                                <td>
						                                	<#if item.money?exists>
						                                		<#if (item.money != 0 )>
							                                		${item.money?string('#.00')}
							                                	<#else>
							                                	 	${item.money?string('0.00')}
							                                	</#if>
						                                	</#if>
						                                </td>
						                                <td>
						                                	<#if item.fee?exists>
						                                		<#if (item.fee != 0 )>
							                                		${item.fee?string('#.00')}
							                                	<#else>
							                                	 	${item.fee?string('0.00')}
							                                	</#if>
						                                	</#if>
						                                </td>
						                                <td>
						                                	<#if item.balance?exists>
						                                		<#if (item.balance != 0 )>
							                                		${item.balance?string('#.00')}
							                                	<#else>
							                                	 	${item.balance?string('0.00')}
							                                	</#if>
						                                	</#if>
						                                </td>
						                                <td>
						                                	${(item.createTime?string("yyyy-MM-dd HH:mm:ss"))!}
						                                </td>
						                                <td class="last">
						                                	<#if item.isRecharge=='N'>
						                                		<a class="btn-recharge" data-id="${item.id}">充值</a>						                                	
						                                	</#if>
						                                </td>
						                             </tr>   
						                        </#list>
											<#else>
												<tr class="even pointer">
													<td colspan="11">无记录</td>
												</tr>
											</#if>
				                        </tbody>
				                    </table>
				                    <#if (pageInfo.pageList?size > 0)>
				                    	<#include "../base/Page.ftl">
				                    </#if>
				                </div>
                            </div>
                       </div>
                   </div>
             </div>
        </div>
    </div>
</div>
<script src="${_js}/bootstrap.min.js"></script>
<!-- bootstrap progress js -->
<script src="${_js}/progressbar/bootstrap-progressbar.min.js" type="text/javascript"></script>
<script src="${_js}/nicescroll/jquery.nicescroll.min.js" type="text/javascript"></script>
<!-- icheck -->
<script src="${_js}/icheck/icheck.min.js" type="text/javascript"></script>
<script src="${_js}/custom.js" type="text/javascript"></script>
<!-- PNotify -->
<script src="${_js}/notify/pnotify.core.js" type="text/javascript"></script>
<script src="${_js}/notify/pnotify.buttons.js" type="text/javascript"></script>
<script src="${_js}/notify/pnotify.nonblock.js" type="text/javascript" ></script>
<script type="text/javascript">
	$(document).ready(function () {
        $('input.tableflat').iCheck({
            checkboxClass: 'icheckbox_flat-green',
            radioClass: 'iradio_flat-green'
        });
    });
    
    $(".btn-recharge").click(function(){
    	if(confirm("确定要充值吗？点击确定这笔金额会进入到该用户的个人账户中。")){
		    var id=$(this).attr("data-id");
	    	$.ajax({
	            type: 'post',
	            dataType: 'JSON',
	            async:'false',
	            url: '/admin/recharge/offline/add',
	            data:{id:id},
	            success: function(result){
	            	if(result.code==-1){
	            		new PNotify({
			            	title: '操作提示',
			            	text: '操作成功,请等待管理员审核！',
			            	delay: 3e3,
			            	type: 'success'
			        	});
			        	return false;	            		
	            	}else{
	            		new PNotify({
			            	title: '操作提示',
			            	text:  result.msg,
			            	delay: 3e3,
			            	type: 'error'
			        	});
			        	return false;		            		
	            	}
	            }
	        });
    	}
    })
    
	function initData(action) { 
		var username= $.trim($("#username").val());
    	var match = $.trim($("#match").find("option:selected").val());
    	var money = $.trim($("#money").val());
    	if(username !=""){
    		action += "&username="+username;
    	}
    	if(match != -1){
    		action += "&match="+match;
    	}
    	if(money !=""){
    		if(match == -1){
    			new PNotify({
		            	title: '操作提示',
		            	text: '请先选择匹配符！',
		            	delay: 3e3,
		            	type: 'error'
		        	});  
		        return;
    		}
    		action += "&money="+money;
    	}
		window.location.href=action;
	} 
	
	$(".btn-info").click(function(){
		initData($("#example").attr('data-action'));
	});
	
</script>